import org.apache.flink.api.common.eventtime.*;

public class Demo04_myselfWatermarkStrategy implements WatermarkStrategy<Demo02_sensorReading> {

    @Override
    public WatermarkGenerator<Demo02_sensorReading> createWatermarkGenerator(WatermarkGeneratorSupplier.Context context) {
        return new WatermarkGenerator<Demo02_sensorReading>() {
            @Override
            public void onEvent(Demo02_sensorReading event, long eventTimestamp, WatermarkOutput output) {

            }

            @Override
            public void onPeriodicEmit(WatermarkOutput output) {

            }
        };
    }

    @Override
    public TimestampAssigner<Demo02_sensorReading> createTimestampAssigner(TimestampAssignerSupplier.Context context) {
        return new SerializableTimestampAssigner<Demo02_sensorReading>() {
            @Override
            public long extractTimestamp(Demo02_sensorReading element, long recordTimestamp) {
                return element.getTimestamp();
            }
        };
    }
}
